package tr.com.oyunus.server.command.handler.impl;

import org.jboss.netty.channel.MessageEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import tr.com.oyunus.bootstrap.FactoryManager;
import tr.com.oyunus.game.Game;
import tr.com.oyunus.game.GameNotFound;
import tr.com.oyunus.server.command.Command;
import tr.com.oyunus.server.command.handler.CommandHandler;
import tr.com.oyunus.server.exception.OyunusException;
import tr.com.oyunus.token.TokenFactory;
import tr.com.oyunus.user.User;
import tr.com.oyunus.user.UserFactory;
import tr.com.oyunus.user.exception.UserNotFound;
import tr.com.oyunus.user.exception.UserNotValid;

import java.util.Map;

/**
 * User: f2xy
 * Date: 02.01.2012
 */
@Component
public class GenerateToken implements CommandHandler<MessageEvent> {
    @Override
    public void handleCommand(Command command, MessageEvent source) throws OyunusException{
        
        if(command.getFunction().equals("createToken"))
        {
            Map<String,String> p = command.getParams();

            User user = FactoryManager.getUserFactory().getUser(p.get("name"),p.get("password"));
            Game game = FactoryManager.getGameFactory().createGame(p.get("game"));
        }

    }

    @Override
    public String[] canHandle() {
        return new String[]{"createToken"};
    }
}
